package com.cloudweb.oa.module.desktop;

import com.cloudweb.oa.api.IDesktopCard;
import com.cloudweb.oa.utils.SpringUtil;
import com.redmoon.oa.ui.menu.Leaf;

import javax.servlet.http.HttpServletRequest;

public class DesktopCardMenuItem implements IDesktopCard {

    DesktopCard desktopCard;

    public DesktopCardMenuItem(DesktopCard desktopCard) {
        this.desktopCard = desktopCard;
    }

    @Override
    public String getTitle() {
        return desktopCard.getTitle();
    }

    @Override
    public int getStartVal() {
        return desktopCard.getStartVal();
    }

    @Override
    public int getEndVal(HttpServletRequest request) {
        return -1;
    }

    @Override
    public boolean isLink() {
        return desktopCard.isLink();
    }

    @Override
    public String getUrl() {
        String menuItem = desktopCard.getMenuItem();
        Leaf lf = new Leaf();
        lf = lf.getLeaf(menuItem);
        return lf.getLink(SpringUtil.getRequest());
    }

    @Override
    public String getUnit() {
        return desktopCard.getUnit();
    }

    @Override
    public String getBgColor() {
        return desktopCard.getBgColor();
    }

    @Override
    public String getIcon() {
        return desktopCard.getIcon();
    }
}
